package com.eight.cloud.payment.service.partnerpayments.wxcodepay.model;

import com.google.gson.annotations.SerializedName;
import com.wechat.pay.java.service.partnerpayments.model.PromotionDetail;
import com.wechat.pay.java.service.partnerpayments.model.TransactionAmount;
import com.wechat.pay.java.service.partnerpayments.model.TransactionPayer;
import lombok.Data;

import java.util.List;

import static com.wechat.pay.java.core.util.StringUtil.toIndentedString;

/**
 * @ClassName: Transaction
 * @Author: TXC
 * @Date: 2025-06-12 17:10
 **/
@Data
public class Transaction {
    /** amount */
    @SerializedName("amount")
    private TransactionAmount amount;

    /** spAppid */
    @SerializedName("sp_appid")
    private String spAppid;

    /** subAppid */
    @SerializedName("sub_appid")
    private String subAppid;

    /** spMchid */
    @SerializedName("sp_mchid")
    private String spMchid;

    /** subMchid */
    @SerializedName("sub_mchid")
    private String subMchid;

    /** attach */
    @SerializedName("attach")
    private String attach;

    /** bankType */
    @SerializedName("bank_type")
    private String bankType;

    /** outTradeNo */
    @SerializedName("out_trade_no")
    private String outTradeNo;

    /** payer */
    @SerializedName("payer")
    private TransactionPayer payer;

    /** promotionDetail */
    @SerializedName("promotion_detail")
    private List<PromotionDetail> promotionDetail;

    /** successTime */
    @SerializedName("success_time")
    private String successTime;

    /** tradeState */
    public enum TradeStateEnum {
        @SerializedName("SUCCESS")
        SUCCESS,

        @SerializedName("REFUND")
        REFUND,

        @SerializedName("NOTPAY")
        NOTPAY,

        @SerializedName("CLOSED")
        CLOSED,

        @SerializedName("REVOKED")
        REVOKED,

        @SerializedName("USERPAYING")
        USERPAYING,

        @SerializedName("PAYERROR")
        PAYERROR,

        @SerializedName("ACCEPT")
        ACCEPT
    }

    @SerializedName("trade_state")
    private TradeStateEnum tradeState;

    /** tradeStateDesc */
    @SerializedName("trade_state_desc")
    private String tradeStateDesc;

    /** tradeType */
    public enum TradeTypeEnum {
        @SerializedName("JSAPI")
        JSAPI,

        @SerializedName("NATIVE")
        NATIVE,

        @SerializedName("APP")
        APP,

        @SerializedName("MICROPAY")
        MICROPAY,

        @SerializedName("MWEB")
        MWEB,

        @SerializedName("FACEPAY")
        FACEPAY
    }

    @SerializedName("trade_type")
    private TradeTypeEnum tradeType;

    /** transactionId */
    @SerializedName("transaction_id")
    private String transactionId;

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("class Transaction {\n");
        sb.append("    amount: ").append(toIndentedString(amount)).append("\n");
        sb.append("    spAppid: ").append(toIndentedString(spAppid)).append("\n");
        sb.append("    subAppid: ").append(toIndentedString(subAppid)).append("\n");
        sb.append("    spMchid: ").append(toIndentedString(spMchid)).append("\n");
        sb.append("    subMchid: ").append(toIndentedString(subMchid)).append("\n");
        sb.append("    attach: ").append(toIndentedString(attach)).append("\n");
        sb.append("    bankType: ").append(toIndentedString(bankType)).append("\n");
        sb.append("    outTradeNo: ").append(toIndentedString(outTradeNo)).append("\n");
        sb.append("    payer: ").append(toIndentedString(payer)).append("\n");
        sb.append("    promotionDetail: ").append(toIndentedString(promotionDetail)).append("\n");
        sb.append("    successTime: ").append(toIndentedString(successTime)).append("\n");
        sb.append("    tradeState: ").append(toIndentedString(tradeState)).append("\n");
        sb.append("    tradeStateDesc: ").append(toIndentedString(tradeStateDesc)).append("\n");
        sb.append("    tradeType: ").append(toIndentedString(tradeType)).append("\n");
        sb.append("    transactionId: ").append(toIndentedString(transactionId)).append("\n");
        sb.append("}");
        return sb.toString();
    }
}
